export function getDiffDay(date1) {
  let totalDays, diffDate
  let now = new Date();
  date1 = date1.replaceAll('-','/')
  let dateObj = new Date(date1)
  diffDate = Math.abs(now - dateObj)
  totalDays = Math.floor(diffDate / (1000 * 3600 * 24))
  if(totalDays >30 && totalDays <= 365) {
    return Math.floor(totalDays / 30) + '月前'
  }
  if(totalDays > 365) {
    return Math.floor(totalDays / 365) + '年前'
  }
  return totalDays + '天前'
}

export function getFormatTime(date1) {
  date1 = date1.replaceAll('-','/')
  let dateObj = new Date(date1)
  return dateObj.getMonth() + 1 + '月' + dateObj.getDate() + '日' + ' ' + dateObj.getHours() + ':' + dateObj.getMinutes()
}